package com.gaomall.seckill.exception;

import com.gaomall.seckill.enums.ResponseStatusCode;
import lombok.Getter;

/**
 * 通用
 * 使用方式：throw new CommonException(ResponseStatusCode.SUCCESS);
 */
@Getter
public class CommonException extends RuntimeException{

    private Integer code;

    public CommonException(ResponseStatusCode responseStatusCode){

        super(responseStatusCode.getReturn_msg());
        this.code = responseStatusCode.getReturn_code();

    }

    public CommonException(Integer code, String msg){
        super(msg);
        this.code = code;

    }
}
